package com.youfang.sixthmedia;

import com.gzit.store.StoreManager;
import com.gzit.utils.AndroidUtils;
import com.youfang.sixthmedia.chat.service.BuddyMessageService;
import com.youfang.sixthmedia.chat.service.UNReadMessageMonitorService;
import com.youfang.sixthmedia.common.BaiduMapApplication;
import com.youfang.sixthmedia.common.YoufangContext;
import com.youfang.sixthmedia.controller.AdController;
import com.youfang.sixthmedia.message.model.Advertisment;
import com.youfang.sixthmedia.message.model.ChatItem;
import com.youfang.sixthmedia.message.model.User;
import com.youfang.sixthmedia.net.HttpRemoter;
import com.youfang.sixthmedia.version.VersionManager;

public class YouFangApplication extends BaiduMapApplication {

	// 广告控制器
	public AdController adController = new AdController();

	@Override
	public void onCreate() {
		super.onCreate();
		AndroidUtils.regAppContext(this);
		initDB();
		adController.start();

		// 初始化配置
		YoufangContext.init();

		VersionManager.getInstance().initContext(this);

	}

	@Override
	public void onTerminate() {
		super.onTerminate();
		HttpRemoter.shutdownRemoters();

	}

	// 初始化数据库
	public void initDB() {
		StoreManager.dbName("youfang");
		StoreManager.dbVersion(2);
		StoreManager.regStores(Advertisment.DUMY, User.DUMY, ChatItem.DUMY);
		StoreManager.instance = new StoreManager(this);
	}

}
